home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.19980424-19980901
/
000234_news@newsmaster….columbia.edu _Fri Jun 26 11:10:01 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
4KB
Return-Path: <news@newsmaster.cc.columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id LAA27815
for <kermit.misc@watsun.cc.columbia.edu>; Fri, 26 Jun 1998 11:10:00 -0400 (EDT)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id LAA00696
for kermit.misc@watsun; Fri, 26 Jun 1998 11:10:00 -0400 (EDT)
Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: Get port of previous failed set line command
Date: 26 Jun 1998 15:09:56 GMT
Organization: Columbia University
Lines: 76
Message-ID: <6n0dk4$ri8$1@apakabar.cc.columbia.edu>
References: <3593B304.716C@yahoo.com>
NNTP-Posting-Host: watsun.cc.columbia.edu
Xref: news.columbia.edu comp.protocols.kermit.misc:8925
In article <3593B304.716C@yahoo.com>, Art L. <art1958@yahoo.com> wrote:
: I have a kermit script which then "takes" from a file called kermit.dat.
: kermit.dat contains "set line /dev/tty1A" (or what ever the local modem
: port may be). If the modem is not available the parent script is aware
: of this because \v(line) equals /dev/tty.
:
Or because the SET LINE command failed.
: What I would like to do is add some code to the parent script to keep
: attempting to set line /dev/ttysomething every 10 seconds until it is
: available. However the parent script does not know what the
: ttysomething should be. There does not seem to be a built in variable
: which contains this information.
:
So define your own variable. The top script can:
define deviceiwant /dev/tty1A
and the bottom script can refer to it as:
\m(deviceiwant)
: Currently I have my take kermit.dat command in a loop from which I
: break out of if \v(line) is something other than /dev/tty.
:
Well, I'm not sure why you have two script files, but the normal way to
do this kind of thing is:
define deviceiwant /dev/tty1A ; Device
define \%t 100 ; Number of tries
for \%i 1 \%t 1 { ; Loop to try \%t times to open the device
set line \m(deviceiwant)
if success break
pause 10
}
if > \%i \%t stop 1 Failed to open \m(deviceiwant) after \%t tries.
A refinement on this allows you to cycle through a list of dialout devices
until you get one (the one-line array initialization requires C-Kermit 6.1):
define \%n 5 ; Number of lines
define \%t 100 ; Number of tries per line
declare \&a[\%n] = /dev/cua0 /dev/cua1 /dev/ttyS3 /dev/ttyS4 /dev/modem5
for \%i 1 \%t 1 { ; Loop for \%t tries
for \%j 1 \%n 1 { ; Loop for each device
set line \&a[\%j]
if success goto gotit
}
pause 10 ; Pause probably not needed here
}
if > \%1 \%t stop 1 Failed to get a line
:gotit
...
A further refinement would read the available devices from the UUCP
Devices file, but that's problematic because (a) this file is normally
read-protected, and (b) its format is likely to vary from one UNIX version
to another.
: What I
: really want to do is to read the lock file (ie /usr/spool/uucp/LCK..1a)
: to get the process ID (and therefore the program and user) of the
: locking process.
:
That will not be possible if the lock file is read-protected. Also note that
the name and location of the lockfile, as well as the format of the PID, will
vary from one UNIX version to another.
When C-Kermit determines that a device is locked, it displays the pid from
the lockfile (using built-in knowledge about the location, name, and format
of the lockfile), but this information is currently not available
programmatically. I'll add this to the list for C-Kermit 6.1.
- Frank